package com.nondo.rdp.finance.repository.circle;

import java.util.Optional;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import com.nondo.rdp.core.common.StatusConstant;
import com.nondo.rdp.finance.domain.circle.CircleComment;

public interface CircleCommentRepository extends JpaRepository<CircleComment, Long>, JpaSpecificationExecutor<CircleComment> {
	@Query("select a from CircleComment a where a.id=:id and delFlag = '"
			+ StatusConstant.DEL_FLAG_NORMAL + "'")
	Optional<CircleComment> findOne(@Param("id") int id);
	
    @Modifying
    @Query("update CircleComment set delFlag='" + StatusConstant.DEL_FLAG_DELETE + "' where id = ?1")
    void deleteById(Long id);

    CircleComment save(CircleComment activity);
}
